<template>
  <form @click.prevent>
    <slot></slot>
  </form>
</template>

<script>
export default {
  name: "elForm",
  provide() {
    return { elForm: this };
  },
  props: {
    model: {
      type: Object,
      default: () => {
        return {};
      },
    },
    rules: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  methods: {
    validate(cb) {
      console.log(this.$broadcast("elFormItem"));
      let flag = this.$broadcast("elFormItem").every((item) => item.validate());
      cb(flag);
    },
  },
};
</script>

<style></style>
